//
//  BaseTableView.m
//  待定
//
//  Created by BoyaLee on 15/11/6.
//  Copyright © 2015年 BoyaLee. All rights reserved.
//

#import "BaseTableView.h"

@implementation BaseTableView

-(instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
{
    self = [super initWithFrame:frame style:style];
    if (self) {
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
        if ([[NSUserDefaults standardUserDefaults] boolForKey:@"night"])
        {
            self.backgroundColor = BGNIGHTMODEL;
        }
        else
        {
            self.backgroundColor = BGDAYMODEL;
        }

    }
    return self;
}


-(void)changeColor:(NSNotification *)notification
{
    
    NSString *str = [notification object];
    if ([str isEqualToString:@"no"])
    {
        self.backgroundColor = BGDAYMODEL;
    }
    else
    {
        self.backgroundColor = BGNIGHTMODEL;
    }
    
    
}

@end
